# Importing Data
ROMANIA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "Z1:Z229")

# Checking the Imported Data
View(ROMANIA)
# Creating Time Series Data
ROMANIA_ts <- ts(ROMANIA, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
ROMANIA_ts
sum(is.na(ROMANIA_ts))
library(forecast)
ROMANIA_ts <- tsclean(ROMANIA_ts)
ROMANIA_ts

# Identification: Plotting the Time Series Data
plot(ROMANIA_ts)

# Estimating the appropriate model
ROMANIA_ts_model <- auto.arima(ROMANIA_ts)
ROMANIA_ts_model

# Forecasting
options(max.print=1000000)
ROMANIA_ts_forecast <- forecast (ROMANIA_ts_model, level=c(95), h=288)
plot(ROMANIA_ts_forecast)
ROMANIA_ts_forecast             

# Exporting
write.table(ROMANIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/ROMANIA_TSA.csv", sep=",")
